<template>
	<view style="min-height: 100vh;">
		<u-navbar :title="assignTaskTitle" :autoBack="true" leftIconColor="#1E272E" bgColor="transparent"
			:titleStyle="{fontWeight:700,fontSize:'32rpx',color:'#1E272E'}"></u-navbar>
		<image src="https://renovationcdn.jiachuangnet.com/details1/bg.png" class='bg'
			style="height: 476rpx;width: 100%;"></image>
		<view class="container">
			<view class="container_box">
				<view class="flex alignItem bewteen">
					<view class="label" style="width:200rpx">订单名称<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<view class="val">
						<u-input v-model="info.assignName" placeholder="请输入订单名称" :disabled="assignTaskId&&!assignNo"
							inputAlign="right"></u-input>
					</view>
				</view>
			<!-- 	<view class="flex alignItem bewteen">
					<view class="label" style="width:200rpx">店铺名称<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<view class="val">
						<u-input v-model="info.storeName" placeholder="请输入店铺名称" :disabled="assignTaskId&&!assignNo"
							inputAlign="right"></u-input>
					</view>
				</view> -->
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">装修公司<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<uni-data-select style="width: 450rpx;" v-model="companyId" :disabled="assignTaskId&&!assignNo"
						:localdata="companyList" @change="changeCompanyId"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">店铺类型<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<uni-data-select style="width: 250rpx;" v-model="storeType" :disabled="assignTaskId&&!assignNo"
						:localdata="storeTypeList" @change="change"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen" @click='map'>
					<view class="label" style="width:200rpx">详细地址<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<view class="val" style="display:flex;align-items:center;justify-content: flex-end;">
						<text>{{info.storeAddress}}</text>
						<u-icon name="map" size="24" color='#c7ccd3'></u-icon>
					</view>
				</view>
				<view class="flex alignItem bewteen" v-if="taskTemplateList">
					<view class="label" style="width:250rpx">工期（天）<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<uni-data-select style="width: 250rpx;" :disabled="assignTaskId&&!assignNo" v-model="templateId"
						:localdata="taskTemplateList" @change="change"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen">
					<view class="label" style="width:300rpx">计划完工时间<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<view class="val" @click="calendarShowFn" v-if="info.endTime"
						style="text-align: right;font-size: 28rpx;">
						{{info.endTime}}
						<!-- <u-input v-model="" :disabled="true" placeholder="请选择计划完工时间" inputAlign="right"></u-input> -->
					</view>
					<view class="val" @click="calendarShowFn" style="text-align: right;color: #c7ccd3;font-size: 28rpx;"
						v-else>
						请选择计划完工时间
					</view>
				</view>


				<!-- <view class="flex alignItem bewteen">
					<view class="label" style="width:250rpx">施工负责人<text style="color:red;margin-right: 10rx;">*</text></view>
					<uni-data-select   style="width: 250rpx;" :disabled="assignTaskId&&!assignNo" v-model="jlValue" :localdata="jlRange" @change="change"></uni-data-select>
				</view> -->
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">监理人员<text style="color:red;margin-right: 10rx;">*</text>
					</view>
					<u-input v-if="assignTaskId&&!assignNo" v-model="chargeUserName" :disabled="true"
						inputAlign="right"></u-input>
					<uni-data-select v-else style="width: 280rpx;" v-model="pmValue" :localdata="pmRange"
						@change="change"></uni-data-select>
				</view>
				<!-- <view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">发货仓库</view>
					<uni-data-select
				     style="width: 250rpx;"
					     v-model="warehouseValue"
					     :localdata="warehouseRange"
						 :disabled="assignTaskId&&!assignNo"
					     @change="change"
					   ></uni-data-select>
							 
				</view> -->

				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">冷链公司</view>
					<u-input v-if="assignTaskId&&!assignNo" v-model="coldCCompanyName" :disabled="true"
						inputAlign="right"></u-input>
					<uni-data-select v-else style="width: 450rpx;" v-model="coldCompanyId"
						:localdata="coldChainRange"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">监控公司</view>
					<u-input v-if="assignTaskId&&!assignNo" v-model="monitorCompanyName" :disabled="true"
						inputAlign="right"></u-input>
					<uni-data-select v-else style="width: 450rpx;" v-model="monitorCompanyId"
						:localdata="monitorRange"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">货架公司</view>
					<u-input v-if="assignTaskId&&!assignNo" v-model="goodsCompanyName" :disabled="true"
						inputAlign="right"></u-input>
					<uni-data-select v-else style="width: 450rpx;" v-model="goodsCompanyId"
						:localdata="shelvesRange"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">门窗公司</view>
					<u-input v-if="assignTaskId&&!assignNo" v-model="windowCompanyName" :disabled="true"
						inputAlign="right"></u-input>
					<uni-data-select v-else style="width: 450rpx;" v-model="windowsCompanyId"
						:localdata="windowsCompanyRange"></uni-data-select>
				</view>
				<view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">广告公司</view>
					<u-input v-if="assignTaskId&&!assignNo" v-model="adCompanyName" :disabled="true"
						inputAlign="right"></u-input>
					<uni-data-select v-else style="width: 450rpx;" v-model="adCompanyId"
						:localdata="adCompanyRange"></uni-data-select>
				</view>

				<uni-forms :modelValue="formData">
					<uni-forms-item label="设计人员" name="name" label-width="70" v-if="assignTaskId&&!assignNo">
						<u-input v-model="designName" :disabled="true" inputAlign="right" placeholder="2333"></u-input>
					</uni-forms-item>

					<uni-forms-item label="设计人员" name="name" label-width="70" v-else>
						<uni-combox style="width: 280rpx; box-sizing: border-box;" :border="false"
							:candidates="designNameRange" placeholder="请选择" v-model="designUserName"
							@input="inputHandler(13)"></uni-combox>
					</uni-forms-item>

				</uni-forms>


				<uni-forms :modelValue="formData">
					<uni-forms-item label="预结算人员" name="name" label-width="70" v-if="assignTaskId&&!assignNo">
						<u-input v-model="settlementName" :disabled="true" inputAlign="right"></u-input>
					</uni-forms-item>



					<uni-forms-item label="预结算人员" name="name" label-width="70" v-else>
						<uni-combox style="width: 280rpx; box-sizing: border-box;" :border="false"
							:candidates="preSettlementRange" placeholder="请选择" v-model="preSettlementName"
							@input="inputHandler(12)"></uni-combox>
					</uni-forms-item>

				</uni-forms>

				<!-- <view class="flex alignItem bewteen">
					<view class="label" style="width:160rpx">售后</view>
					<uni-data-select    style="width: 250rpx;"  v-model="afterValue" :disabled="assignTaskId&&!assignNo" :localdata="afterRange" @change="change"></uni-data-select>
				</view> -->
				<view class="flex alignItem bewteen" v-if="brandPartyId!=1">
					<view class="label" style="width:160rpx">店长姓名</view>
					<u-input v-model="storeStaffName" placeholder="请输入店长姓名" :disabled="assignTaskId"
						inputAlign="right"></u-input>
				</view>
				<view class="flex alignItem bewteen" v-if="brandPartyId!=1">
					<view class="label" style="width:160rpx">店长电话</view>
					<u-input v-model="storeStaffPhone" placeholder="请输入店长电话" :disabled="assignTaskId"
						inputAlign="right"></u-input>
				</view>
				<view class="flex alignItem1 bewteen">
					<view class="label" style="width:160rpx">备注</view>
					<view class="val">
						<!-- count 会有length报错 -->
						<u--textarea v-model="info.remark"  count  placeholder="请输入门店备注"
							:disabled="assignTaskId&&!assignNo"></u--textarea>
					</view>
				</view>
			</view>
			<view class="bottom" :style="{marginBottom: bottom+'px'}" style="justify-content: center;"
				v-if="!assignNo&&!assignTaskId">
				<view style="margin-bottom: 20rpx;">
					<u-button style="height: 88rpx;" :plain="true" color='#13989a' @click="submit(0)">保存</u-button>
				</view>
				<!-- "订单状态：0 待确认 1 取消订单 2 确认订单" -->
				<u-button style="height: 88rpx;" color='#13989a' @click="submit(2)">确认发送</u-button>
			</view>
			<view class="bottom" :style="{marginBottom: bottom+'px'}" style="justify-content: center;" v-if="assignNo">
				<u-button style="height: 88rpx;" :plain="true" color='#13989a' @click="updateAssignTask">保存</u-button>
			</view>
		</view>

		<u-calendar :show="calendarShow" color="#13989a" @confirm="confirm" @close="calendarShow=false"></u-calendar>
	</view>
</template>
<script>
	  
	import Decimal from 'decimal.js'
	import upload from '@/components/upload/upload.vue'
	let app = getApp();
	export default {
		data() {
			return {
				formData: {
					name: ''
				},
				loginType: 13, // 12 预结算人员 13 设计人员
				assignNo: null,
				assignTaskId: 0,
				companyId: null,
				calendarShow: false,
				bottom: app.globalData.safeBottom,
				color: app.globalData.defaultColor,
				taskTemplateList: [],
				current: 0,
				templateId: '',
				pic: [],
				info: {
					assignName: '',
					orderName: '',
					// storeName: '',
					lat: '',
					lon: '',
					storeAddress: '',
					remark: '',
					endTime: null,
				},
				storeStaffName: '',
				storeStaffPhone: '',
				range: [],
				companyValue: '',
				taskRange: [],
				taskValue: '',
				pmRange: [],
				pmValue: '',
				jlRange: [],
				jlValue: '',
				userRange: [],
				userValue: '',
				warehouseRange: [],
				warehouseValue: '',
				afterRange: [],
				afterValue: '',
				fileList3: [],
				current: 0,
				remark: '',
				brandPartyId:"",
				picCAD: [],
				storeType: null,
				assignTaskTitle: '',
				storeTypeList: null,
				companyList: [],
				shelvesRange: [],
				monitorRange: [],
				coldChainRange: [],
				windowsCompanyRange: [],
				adCompanyRange: [],
				designNameRange: [],
				designUserName: '',
				currentDesignerId: 0,
				preSettlementRange: [],
				currentSettlementId: 0,
				preSettlementName: '',
				adCompanyId: '',
				windowsCompanyId: '',
				coldCompanyId: '',
				monitorCompanyId: '',
				goodsCompanyId: '',
				coldCCompanyName: '',
				goodsCompanyName: '',
				monitorCompanyName: '',
				windowCompanyName: '',
				adCompanyName: '',
				designName: '',
				settlementName: '',
				chargeUserName: ''
			}
		},

		onShow() {
			// this.getTaskTemplateList()
			this.getOtherCompanyList()
			this.getUserList(12)
			this.getUserList(13)
			const brandPartyId = uni.getStorageSync('brandPartyId')
			this.brandPartyId=brandPartyId
			if (brandPartyId == 1) {
				this.storeTypeList = [{
						value: 1,
						text: '普通店'
					},
					{
						value: 2,
						text: '旗舰店'
					},
				]
			} else if (brandPartyId == 2) {
				this.storeTypeList = [{
						value: 1,
						text: '加盟店'
					},
					{
						value: 2,
						text: '旗舰店'
					},
				]
			}
		},
		onLoad(query) {
			this.getAreaList()
			// 查询监理
			this.getUserCompany(1).then(res => {
				this.pmRange = res.map(item => {
					return {
						value: item.userId,
						text: item.userName
					}
				})
			})

			uni.$u.http.get('/company/getCompanyList', {
				params: {
					pageNumber: 1,
					pageSize: 100000,
				}
			}).then(res => {
				if (res.data) {
					this.companyList = res.data.map(item => {
						return {
							value: item.companyId,
							text: item.companyName
						}
					})
				}
			})


			// // 查询公司经历
			// this.getUserCompany(2).then(res=>{
			// 	this.jlRange=res.map(item=>{
			// 		return {
			// 			value:item.userId,
			// 			text:item.userName
			// 		}
			// 	})
			// })
			// 查询装修售后
			this.getUserCompany(3).then(res => {
				this.afterRange = res.map(item => {
					return {
						value: item.userId,
						text: item.userName
					}
				})
			})

			if (query.assignTaskId) {
				this.assignTaskId = query.assignTaskId
				// 查看或编辑
				this.getBrandTaskDetailById()
			}
			if (query.assignNo) {
				this.assignNo = query.assignNo
			}

			if (query.assignNo && query.assignTaskId) {
				this.assignTaskTitle = '编辑订单'
			}
			if (!query.assignNo && query.assignTaskId) {
				this.assignTaskTitle = '查看订单'
			}
			if (!query.assignNo && !query.assignTaskId) {
				this.assignTaskTitle = '添加订单'
			}
		},
		methods: {
			/**
			 * combox输入事件
			 * author: iceyhu
			 * description: 
			 * @param 
			 * @return 
			 * @createTime: 2025-07-04 16:29:04
			 */
			inputHandler(type) {
				console.log('type: ', type);
				if (type == 13) {
					this.currentDesignerId = this.designer.find(item => item.userName == this.designUserName)?.userId
				} else if (type == 12) {
					this.currentSettlementId = this.settlement.find(item => item.userName == this.preSettlementName)
						?.userId
				}
				// console.log('this.designer', this.designer);
				// console.log('settlement', this.settlement);

			},

			/**
			 * 方法说明 获取设计人员和预结算人员
			 * author: iceyhu
			 * description: 
			 * @param 
			 * @return 
			 * @createTime: 2025-07-04 16:09:26
			 */
			getUserList(loginType) {
				uni.$u.http.get('/assign/getUserList', {
					params: {
						loginType
					}
				}).then(res => {
					console.log('res: ', res);
					if (res.length) {
						if (loginType == 13) { // 设计
							this.designer = res
							this.designNameRange = res.map(item => item.userName)
						} else if (loginType == 12) { // 预结算
							this.settlement = res
							this.preSettlementRange = res.map(item => item.userName)
						}
					}

				})

			},
			getOtherCompanyList() {
				// 1 装修公司 2 冷链公司 3 货架公司 4 监控公司 5 门窗公司 6 广告公司
				uni.$u.http.get('/company/getOtherCompanyList', {
					params: {
						companyType: 2 //
					}
				}).then(res => {
					if (res) {
						this.coldChainRange = res.map(item => {
							return {
								value: item.companyId,
								text: item.companyName
							}
						})
					}
				})
				uni.$u.http.get('/company/getOtherCompanyList', {
					params: {
						companyType: 3
					}
				}).then(res => {
					if (res) {
						this.shelvesRange = res.map(item => {
							return {
								value: item.companyId,
								text: item.companyName
							}
						})

					}
				})
				uni.$u.http.get('/company/getOtherCompanyList', {
					params: {
						companyType: 4
					}
				}).then(res => {
					if (res) {
						this.monitorRange = res.map(item => {
							return {
								value: item.companyId,
								text: item.companyName
							}
						})
					}
				})
				uni.$u.http.get('/company/getOtherCompanyList', {
					params: {
						companyType: 5
					}
				}).then(res => {
					if (res) {
						this.windowsCompanyRange = res.map(item => {
							return {
								value: item.companyId,
								text: item.companyName
							}
						})
					}
				})
				uni.$u.http.get('/company/getOtherCompanyList', {
					params: {
						companyType: 6 //1 冷链 2 货架 3 监控    
					}
				}).then(res => {
					if (res) {
						this.adCompanyRange = res.map(item => {
							return {
								value: item.companyId,
								text: item.companyName
							}
						})
					}
				})
			},
			calendarShowFn() {
				if (this.assignTaskId && !this.assignNo) return
				this.calendarShow = true
			},
			updateAssignTask() {
				if (!this.verity()) {
					return uni.$u.toast('请检查必传字段:)');
				}
				if (this.flag == 1) {
					return uni.showLoading({
						title: '请勿重复提交 :)'
					});
				}
				if (this.timer) {
					return uni.$u.toast('提交太频繁了!');
				}
				this.timer = setTimeout(() => {
					this.timer = null
				}, 3000)
				this.flag = 1
				uni.$u.http.post('/assign/updateBrandTask', {
					assignTaskId: this.assignTaskId,
					assignName: this.info.assignName,
					// storeName: this.info.storeName,
					planEndTime: this.info.endTime,
					templateId: this.templateId,
					address: this.info.storeAddress,
					companyId: this.companyId,
					// projectUserId:this.jlValue ,
					chargeUserId: this.pmValue,
					areaId: this.warehouseValue,
					// afterId:this.afterValue, 
					lon: this.info.lon,
					lat: this.info.lat,
					remark: this.info.remark,
					elevations: this.pic,
					storeType: this.storeType,
					adCompanyId: this.adCompanyId,
					windowsCompanyId: this.windowsCompanyId,
					coldCompanyId: this.coldCompanyId,
					monitorCompanyId: this.monitorCompanyId,
					goodsCompanyId: this.goodsCompanyId
					// storeStaffName:this.storeStaffName,
					// storeStaffPhone:this.storeStaffPhone
				}).then(res => {
					if (res) {
						uni.showToast({
							title: '修改成功!',
							duration: 1000,
							mask: true,
							complete: () => {
								setTimeout(() => {
									uni.navigateBack()
								}, 1000)
							}
						})
					}
				})
			},
			getBrandTaskDetailById() {
				uni.$u.http.get('/assign/getBrandTaskDetailById', {
					params: {
						assignTaskId: this.assignTaskId
					}
				}).then(res => {
					if (res) {
						if (res.companyId) {
							this.changeCompanyId(res.companyId)
						}
						this.designName = res.designName
						this.settlementName = res.settlementName
						this.info.assignName = res.assignName
						// this.info.storeName = res.storeName
						this.info.endTime = res.planEndTime
						this.templateId = res.templateId
						this.info.storeAddress = res.address
						this.companyId = res.companyId
						this.jlValue = res.projectUserId
						this.pmValue = res.chargeUserId
						this.warehouseValue = res.areaId
						this.afterValue = res.afterId
						this.info.lon = res.longitude
						this.info.lat = res.latitude
						this.info.remark = res.remark || '暂无备注'
						this.storeType = res.storeType
						this.storeStaffName = res.storeStaffName || ''
						this.storeStaffPhone = res.storeStaffPhone || ''
						this.adCompanyId = res.adCompanyId
						this.windowsCompanyId = res.windowsCompanyId
						this.coldCompanyId = res.coldCompanyId
						this.monitorCompanyId = res.monitorCompanyId
						this.goodsCompanyId = res.goodsCompanyId
						this.coldCCompanyName = res.coldCCompanyName
						this.goodsCompanyName = res.goodsCompanyName
						this.monitorCompanyName = res.monitorCompanyName
						this.windowCompanyName = res.windowCompanyName
						this.adCompanyName = res.adCompanyName
						this.chargeUserName = res.chargeUserName
					}


				})


			},
			changeCompanyId(e) {
				console.log(e)
				this.jlValue = null
				this.templateId = null
				this.getTaskList(e)
				uni.$u.http.get('/company/getManagerList', {
					params: {
						companyId: e,
					}
				}).then(res => {
					if (res) {
						this.jlRange = res.map(item => {
							return {
								value: item.userId,
								text: item.userName
							}
						})
					}
				})

			},
			confirm(e) {
				console.log(e)
				this.calendarShow = false
				this.info.endTime = e[0]
			},
			uploadCad(assignTaskId) {
				uni.$u.http.get('/assign/uploadCad', {
					params: {
						assignTaskId,
						cadUrl: this.picCAD[0],
					}
				}).then(res => {
					if (res) {
						uni.redirectTo({
							url: '/pages/index/index',
							success: () => {
								uni.$u.toast('CAD上传成功!');
							}
						});
					} else {
						uni.redirectTo({
							url: '/pages/index/index',
							success: () => {
								uni.$u.toast('CAD上传失败!');
							}
						});
					}

				})
			},
			cadParse(assignTaskId) {
				uni.$u.http.post('/new/cad/parse', {
					assignTaskId,
					cadImg: this.picCAD[0],
					storeType: this.storeType
				}).then(res => {
					console.log(res, '解析')
					if (res && res.code.length == 0) {
						// uni.$u.toast('CAD解析成功!');
						this.uploadCad(assignTaskId)
					} else {
						wx.switchTab({
							url: '/pages/index/index',
							success: () => {
								// uni.$u.toast('CAD解析失败!');
								uni.showModal({
									title: 'CAD解析失败',
									content: res.code.join(','),
								})
							}
						});
					}
				})
			},
			verity() {
				// this.info.storeName &&
				if ( this.info.assignName && this.info.endTime && this.info.storeAddress && this
					.pmValue && this.storeType && this.templateId && this.currentDesignerId && this.currentSettlementId) {
					return true
				} else {
					return false
				}
			},
			submit(orderStatus) {
				if (!this.verity()) {
					return uni.$u.toast('请检查必传字段:)');
				}
				if (this.flag == 1) {
					return uni.showLoading({
						title: '请勿重复提交 :)'
					});
				}
				if (this.timer) {
					return uni.$u.toast('提交太频繁了!');
				}
				this.timer = setTimeout(() => {
					this.timer = null
				}, 3000)
				this.flag = 1
				console.log("this.currentSettlementId", this.currentSettlementId);
				console.log("this.currentDesignerId", this.currentDesignerId);
				uni.$u.http.post('/assign/addAssignTask', {
					assignName: this.info.assignName,
					storeName: this.info.storeName,
					planEndTime: this.info.endTime,
					templateId: this.templateId,
					address: this.info.storeAddress,
					companyId: this.companyId,
					settlementId: this.currentSettlementId,
					designId: this.currentDesignerId,
					// projectUserId:this.jlValue ,
					chargeUserId: this.pmValue,
					areaId: this.warehouseValue,
					afterId: this.afterValue,
					lon: this.info.lon,
					lat: this.info.lat,
					remark: this.info.remark,
					elevations: this.pic,
					cadUrl: null, //解析成功才能上传cad
					storeType: this.storeType,
					storeStaffName: this.storeStaffName,
					storeStaffPhone: this.storeStaffPhone,
					adCompanyId: this.adCompanyId,
					windowsCompanyId: this.windowsCompanyId,
					coldCompanyId: this.coldCompanyId,
					monitorCompanyId: this.monitorCompanyId,
					goodsCompanyId: this.goodsCompanyId,
					orderStatus: orderStatus //订单状态：0 待确认 1 取消订单 2 确认订单"
				}).then(res => {
					console.log(res, '添加任务')
					this.flag = 0
					if (res) {
						if (this.picCAD[0]) {
							this.cadParse(res)
						} else {
							uni.showToast({
								title: '添加成功!',
								duration: 1000,
								mask: true,
								complete: () => {
									setTimeout(() => {
										uni.redirectTo({
											url: '/pages/manageStore/index'
										});
									}, 1000)
								}
							})

						}

					}

				})
			},
			async getUserCompany(flag) {
				const res = await uni.$u.http.get('/assign/getUserCompany', {
					params: {
						flag
					}
				})
				return res
			},
			getAreaList() {
				uni.$u.http.get('/assign/getAreaList', {
					params: {
						brandPartyId: uni.getStorageSync('brandPartyId')
					}
				}).then(res => {
					console.log(res, '获取仓库列表')
					if (res) {
						this.warehouseRange = res.map((item, index) => {
							return {
								value: item.areaId,
								text: item.areaName
							}
						})
					}
				})
			},
			getTaskList(companyId) {
				uni.$u.http.get('/template/getTaskTemplateList', {
					params: {
						companyId,
						pageNumber: 1,
						pageSize: 1000
					}
				}).then(res => {
					console.log(res, '获取任务模板')
					if (res.data) {
						this.taskTemplateList = res.data.map((item, index) => {
							return {
								value: item.templateId,
								text: item.templateName
							}
						})
					}
				})
			},
			change(e) {
				console.log('change', e);
			},
			map() {
				if (this.assignTaskId && !this.assignNo) {
					return
				}

				console.log('高德地图调用')
				uni.chooseLocation({
					type: 'gcj02',
					success: (res) => {
						this.info.lat = res.latitude;
						this.info.lon = res.longitude;
						this.info.storeAddress = res.address;
					}
				})
			},
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			uploadFile(msg) {
				this.pic = msg.files
			},
			uploadCADFile(msg) {
				this.picCAD = msg.files
			},
			getTaskTemplateList() {
				uni.$u.http.get('/template/getTaskTemplateList', {
					params: {
						pageNumber: 1,
						pageSize: 1000
					}
				}).then(res => {
					console.log(res, '获取任务模板')
				})
			}

		}
	}
</script>
<style>
	page {
		background: #fff !important;
		height: 100vh;
		position: relative;
	}
</style>
<style lang="scss" scoped>
	/deep/ .uni-forms-item {
		// display: flex !important;
		justify-content: space-between !important;
		align-items: center !important;
	}

	.val_selet {
		overflow: unset !important;
	}

	.alignItem {
		height: 88rpx;
		box-sizing: border-box;
		font-weight: 500;
		font-size: 28rpx;
		color: #868686;

		.val {
			text-align: start;
		}

		.label {
			font-weight: 500;
			font-size: 28rpx;
			color: #1E272E;
		}
	}

	/deep/ .uni-forms-item {
		margin-bottom: 0 !important;
	}

	/deep/ .uni-combox {
		padding-left: 0 !important;
	}


	/deep/ .uni-forms-item__content {
		flex: none !important;
		padding-right: 8rpx !important;
	}

	/deep/ .uni-forms-item__label {
		color: #000 !important;
	}

	/deep/ .uni-combox.data-v-06b292c9 {
		padding-left: 0 !important;
		width: 250rpx !important;
		box-sizing: border-box !important;
	}


	/deep/ .uni-combox__label {
		box-sizing: border-box !important;
		font-weight: 500 !important;
		font-size: 28rpx !important;
		color: #1E272E !important;
	}



	/deep/ .uni-combox__input-box.data-v-06b292c9 {
		flex: 0 !important;
	}

	/deep/ .uni-combox__input.data-v-06b292c9 {
		width: 212rpx !important;
		box-sizing: border-box !important;
		color: #333 !important;
		text-align: right !important;
	}



	/deep/ .uni-combox__input-plac {
		text-align: right;
		font-size: 27rpx !important;
		color: #ccc !important;
	}

	/deep/ .uni-combox__selector {
		width: 276rpx !important;
		color: #828282 !important;
		z-index: 999 !important;
	}

	::v-deep.container {
		.uni-select--disabled {
			background-color: unset;
		}
	}

	::v-deep.alignItem1 {
		flex-direction: column;
		font-weight: 500;
		font-size: 28rpx;
		color: #868686;

		.u-textarea {
			margin-top: 21rpx;
			background-color: #f5f5f5;

			.u-textarea__count {
				background-color: unset !important;
			}
		}

		.val {
			width: auto;
			text-align: start;
		}

		.label {
			font-weight: 500;
			font-size: 28rpx;
			color: #1E272E;
		}
	}

	.bg {
		width: 750rpx;
		height: 430rpx;
		position: absolute;
		top: 0;
		left: 0;
		z-index: 1;
	}

	.container {
		width: 700rpx;
		position: absolute;
		top: 200rpx;
		left: 25rpx;
		z-index: 2;
		// min-height: 100vh;
		box-sizing: border-box;
		background: #FFFFFF;
		padding: 0 22rpx;
		border-radius: 20rpx;
	}

	.item {
		height: 294rpx;
		width: 700rpx;
		margin-bottom: 20rpx;
		// background-size: 100% 100%;
		// background: url('http://skv5jh74d.hn-bkt.clouddn.com/addMaterial/itemBg.png?e=1728810230&token=Uw65xcftwz9gmAL88CkCQDOLnHuqiD5jAvGQ7msg:wczllfps1gJQtgAUO0-qNJnVuYU=');
	}

	.bottom {
		text-align: center;
		margin-top: 30rpx;
	}

	.container /deep/ .uni-select {
		border: none !important;
	}

	.container /deep/ .u-input {
		background-color: unset !important;
	}

	.container /deep/ .uni-select__input-placeholder {
		font-size: 28rpx !important;
		color: #c7ccd3;
		text-align: right;
	}

	.container /deep/ .uni-icons {
		font-size: 32rpx;
		margin-left: 10rpx;
	}

	.container /deep/ .uni-select__selector-item {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		/* 可选，当内容超出一行时，用省略号表示 */
	}


	.container /deep/ .u-upload__wrap {
		justify-content: flex-end;
	}

	.container /deep/ .uni-select__input-text {
		text-align: right;
	}
</style>
<style>
	page {
		background-color: #f8f8f8;
	}
</style>